﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _2D_Game
{
    static class TextureManager
    {
        static TextureManager()
        {
            TexLib.TexUtil.InitTexturing();
            _textureFiles = new Dictionary<string, int>();
        }

        private static Dictionary<string, int> _textureFiles;

        public static int LoadTexture(string filename)
        {
            int texId;
            if (!_textureFiles.ContainsKey(filename))
            {
                texId = TexLib.TexUtil.CreateTextureFromFile(filename);
                _textureFiles.Add(filename, texId);
            }
            else
                texId = _textureFiles[filename];
            return texId;
        }

        public static bool TextureExists(int texId)
        {
            return _textureFiles.ContainsValue(texId);
        }
    }
}
